<template>
  <div class="input-box">
    <el-input
      v-model.trim="inputValue"
      :placeholder="placeholder"
      @change="handleChange"></el-input>
  </div>
</template>
<script>
export default {
  props: {
    // 输入框的默认值
    defaultValue: {
      type: String,
      default: ''
    },
    // 输入框的占位文字
    placeholder: {
      type: String,
      default: '请输入'
    }
  },
  data () {
    return {
      inputValue: ''
    }
  },
  methods: {
    handleChange () {
      this.$emit('change', this.inputValue)
    }
  },
  created () {
    this.inputValue = this.defaultValue
  }
}
</script>
<style lang="stylus" scoped>

</style>
